# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=watershot
pkgver=0.2.0
pkgrel=0
pkgdesc="A simple wayland native screenshot tool"
url="https://github.com/Kirottu/watershot"
# s390x: no desktop on this arch
# loongarch64: nix crate fails to build
arch="all !s390x !loongarch64"
license="GPL-3.0-only"
depends="grim"
makedepends="
	cargo
	cargo-auditable
	fontconfig-dev
	libxkbcommon-dev
	wayland-dev
	"
source="https://github.com/Kirottu/watershot/archive/v$pkgver/watershot-$pkgver.tar.gz
	cargo-features.patch
	bump-getrandom.patch
	"
options="!check"  # no tests provided

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
8997eaf8277c5abc166b064999d3ba7ddfe88b10536aea07cd91a7fc9e3720490fc6343b6b091d1c9e09d5f3de7b9251f01f926a4ad43600681527320bba4209  watershot-0.2.0.tar.gz
a5b1c7b86970a056894fdb2e9cd174227982764b50fbd96a2765a2d3a1bd729593bee5ac2487dbbc94f247a76bceea17b6bf585c5bc0d734d3e978c8389103c0  cargo-features.patch
4f32b3965f6adf83282617522a2fc026a24170a92a8c1832e15674c92d0c72efe75d177f193b255e6ddb92b495fd851fc901854f9f9c8d9c42a258591b7cc9f8  bump-getrandom.patch
"
